package org.webdb.webapp.jackson;

import java.io.IOException;

import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.JsonGenerator;
import org.postgis.PointComposedGeom;

public class PointComposedJSONSerializer {

    private PointJSONSerializer pointSerializer;

    public PointComposedJSONSerializer(PointJSONSerializer pointSerializer) {
        this.pointSerializer = pointSerializer;
    }

    public void writePointComposed(PointComposedGeom pointComposed,
            JsonGenerator jgen) throws JsonGenerationException, IOException {
        // TODO Auto-generated method stub
        jgen.writeStartArray();
        for (int i = 0; i < pointComposed.numPoints(); i++) {
            pointSerializer.writePoint(pointComposed.getPoint(i), jgen);
        }
        jgen.writeEndArray();
    }

}
